package com.mlyol.single;

public class Method2 {

    public static void main(String[] args) {
        RoadVehicle roadVehicle = new RoadVehicle();
        roadVehicle.run("摩托车");
        AirVehicle airVehicle = new AirVehicle();
        airVehicle.run("飞机");
        WaterVehicle waterVehicle = new WaterVehicle();
        waterVehicle.run("轮船");
    }

    static class RoadVehicle {

        void run(String vehicle) {
            System.out.println(vehicle + " 在公路上跑");
        }

    }

    static class AirVehicle {

        void run(String vehicle) {
            System.out.println(vehicle + " 在空中飞");
        }

    }

    static class WaterVehicle {

        void run(String vehicle) {
            System.out.println(vehicle + " 在水中运行");
        }

    }

}
